home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11503 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: roger.ecn.purdue.edu!jonesbr
  2. From: jonesbr@roger.ecn.purdue.edu (Brian R. Jones)
  3. Newsgroups: comp.lang.c
  4. Subject: Converting numbers to strings?
  5. Date: 24 Mar 1996 20:15:22 GMT
  6. Organization: Purdue University, W. Lafayette, IN
  7. Message-ID: <4j4agq$85h@mozo.cc.purdue.edu>
  8. NNTP-Posting-Host: roger.ecn.purdue.edu
  9.  
  10. I am pretty familiar with the functions that convert strings into
  11. numbers, but am totally unfamiliar with the reverse process.  What
  12. I am looking to do is have a program save several files with the
  13. same basic file root, but differentiated by a number.  For example
  14. I have a loop in my code that varies a variable, q, that varies in
  15. increments of 100.  Each time through the loop, I would like to save
  16. a data file called:
  17.  
  18.         out1q100.dat
  19.         out1q200.dat
  20.         out1q300.dat
  21.         etc.
  22.  
  23. It seems that if I can simply convert the floating point variable, q,
  24. to a string, I could use strcat to add it to the basic filename root,
  25. out1q.  Is there a simple way to do this?  I haven't found anything
  26. in the string(s).h file that would do the trick.  Many thanks!
  27.  
  28. -Brian
  29.  
  30. P.S.  I am running Solaris 5.3 on a Sun workstation if it makes a
  31.       difference.
  32.